const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);

module.exports = {
  publicPath: "./",
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("assets", resolve("src/assets"))
      .set("css", resolve("src/assets/css"))
      .set("img", resolve("src/assets/img"))
      .set("components", resolve("src/components"))
      .set("views", resolve("src/views"));
  },
  chainWebpack: config => {
    const oneOfsMap = config.module.rule("scss").oneOfs.store;
    oneOfsMap.forEach(item => {
      item
        .use("sass-resources-loader")
        .loader("sass-resources-loader")
        .options({
          // 公用scss
          resources: "./src/assets/theme/theme.scss"
        })
        .end();
    });
  },
  devServer:{
    port:8888,
    open:true
  }
};
